package com.qf.shopback.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.qf.common.result.ResultEntity;
import com.qf.entity.Goods;
import com.qf.feign.GoodsFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsFeignService goodsFeignService;
    @RequestMapping("/addGoods")
    @ResponseBody
    public ResultEntity addGoods( Goods goods) {
        return goodsFeignService.addGoods(goods);

    }

    @RequestMapping("/getGoodsPage")
    public String getGoodsPage( Page<Goods> page,Model model) {
        Page<Goods> goodsPage = goodsFeignService.getGoodsPage(page);
        model.addAttribute("goodsPage",goodsPage);
        return "goods/goodsList";

    }
}

